package com.aspose.cells.a.a;

import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Locale;

public class za {
   public final com.aspose.cells.b.a.c.za a;
   public final char b;
   public final char c;
   public final char d;
   public final char e;
   public final int f;
   public final String g;
   public final String h;
   public final String i;
   public final String j;
   public final String k;
   public final String l;
   public final DecimalFormat m;
   public final DateFormat n;
   private final boolean o;
   private final boolean p;
   private final boolean q;

   public za(za var1, char var2, char var3) {
      this.a = var1.a;
      this.b = var1.b;
      this.c = var1.c;
      this.f = var1.f;
      this.g = var1.g;
      this.h = var1.h;
      this.i = var1.i;
      this.j = var1.j;
      this.k = var1.k;
      this.l = var1.l;
      this.m = var1.m;
      this.n = var1.n;
      if (var1.o) {
         if (var2 == var1.d) {
            this.o = true;
         } else {
            this.o = var2 != a(this.a);
         }
      } else {
         this.o = var2 != var1.d;
      }

      if (var1.p) {
         if (var3 == var1.e) {
            this.p = true;
         } else {
            this.p = var3 != b(this.a);
         }
      } else {
         this.p = var3 != var1.e;
      }

      this.d = var2;
      this.e = var3;
      this.q = this.d == '.' && this.e == ',';
   }

   public za(com.aspose.cells.b.a.c.za var1) {
      this(var1, a(var1), b(var1), false, false);
   }

   public za(com.aspose.cells.b.a.c.za var1, char var2, char var3, boolean var4, boolean var5) {
      this.a = var1;
      Locale var6 = var1.h();
      this.m = new DecimalFormat("#.######", new DecimalFormatSymbols(var6));
      this.n = DateFormat.getDateTimeInstance(3, 3, var6);
      DateFormat var7 = DateFormat.getDateInstance(3, var6);
      SimpleDateFormat var8;
      String var9;
      char var10;
      int var11;
      String var15;
      if (var7 instanceof SimpleDateFormat) {
         var8 = (SimpleDateFormat)var7;
         var9 = var8.toPattern();
         if (a(var6)) {
            var9 = var9.replace('-', '/');
         }

         var10 = a(var9, true);
         if (var10 == 0) {
            this.c = '/';
            this.g = "yyyy";
            this.h = "M";
            this.i = "d";
            this.f = 2;
         } else {
            this.c = var10;
            var11 = var9.indexOf(121);
            if (var11 < 0) {
               if (var9.charAt(var9.length() - 1) != var10) {
                  var9 = var9 + var10;
               }

               var9 = var9 + "yyyy";
               this.g = "yyyy";
            } else {
               int var12 = 1;
               ++var11;

               while(var11 < var9.length() && var9.charAt(var11) == 'y') {
                  ++var12;
                  ++var11;
               }

               this.g = var9.substring(var11 - var12, var11);
            }

            var15 = a('M', var9);
            if (var15 == null) {
               var15 = "M";
            }

            this.h = var15;
            var15 = a('d', var9);
            if (var15 == null) {
               var15 = "d";
            }

            this.i = var15;
            var11 = var9.indexOf(121);
            int var13 = var9.indexOf(77);
            int var14 = var9.indexOf(100);
            if (var11 > var13) {
               if (var13 > var14) {
                  this.f = 3;
               } else if (var11 > var14) {
                  this.f = 2;
               } else {
                  this.f = 6;
               }
            } else if (var13 < var14) {
               this.f = 4;
            } else if (var11 > var14) {
               this.f = 7;
            } else {
               this.f = 5;
            }
         }
      } else {
         this.c = '/';
         this.g = "yyyy";
         this.h = "M";
         this.i = "d";
         this.f = 2;
      }

      var7 = DateFormat.getTimeInstance(2, var6);
      if (var7 instanceof SimpleDateFormat) {
         var8 = (SimpleDateFormat)var7;
         var9 = var8.toPattern();
         var10 = a(var9, false);
         if (var10 == 0) {
            this.b = ':';
            this.j = "H";
            this.k = "mm";
            this.l = "ss";
         } else {
            this.b = var10;

            for(var11 = var9.lastIndexOf(var10) + 1; var11 < var9.length() && b(var9.charAt(var11)); ++var11) {
               ;
            }

            var9 = var9.substring(0, var11);
            var15 = a('H', var9);
            if (var15 == null) {
               var15 = "H";
            }

            this.j = var15;
            var15 = a('m', var9);
            if (var15 == null) {
               var15 = "mm";
            }

            this.k = var15;
            var15 = a('s', var9);
            if (var15 == null) {
               var15 = "ss";
            }

            this.l = var15;
         }
      } else {
         this.b = ':';
         this.j = "H";
         this.k = "mm";
         this.l = "ss";
      }

      this.d = var2;
      this.e = var3;
      this.o = var4;
      this.p = var5;
      this.q = this.d == '.' && this.e == ',';
   }

   public static char a(com.aspose.cells.b.a.c.za var0) {
      return var0.d().c().charAt(0);
   }

   public static char b(com.aspose.cells.b.a.c.za var0) {
      return var0.d().b().charAt(0);
   }

   private static char a(String var0, boolean var1) {
      if (var0 != null && !var0.equals("")) {
         boolean var2 = a(var0.charAt(0), var1);
         int var3 = 1;

         char var4;
         for(var4 = 0; var3 < var0.length(); ++var3) {
            char var5 = var0.charAt(var3);
            if (var2) {
               if (!a(var5, var1)) {
                  ++var3;
                  if (var3 < var0.length()) {
                     var5 = var0.charAt(var3);
                     if (a(var5, var1)) {
                        var4 = var0.charAt(var3 - 1);
                        break;
                     }
                  }

                  var2 = false;
               }
            } else if (a(var5, var1)) {
               var2 = true;
            }
         }

         return var4;
      } else {
         return '\u0000';
      }
   }

   private static String a(char var0, String var1) {
      int var2 = var1.indexOf(var0);
      if (var2 < 0) {
         return null;
      } else {
         int var3;
         for(var3 = var2 + 1; var3 < var1.length() && var1.charAt(var3) == var0; ++var3) {
            ;
         }

         return var1.substring(var2, var3);
      }
   }

   private static boolean a(char var0, boolean var1) {
      return var1 ? a(var0) : b(var0);
   }

   private static boolean a(char var0) {
      switch(var0) {
      case 'D':
      case 'M':
      case 'd':
      case 'y':
         return true;
      default:
         return false;
      }
   }

   private static boolean b(char var0) {
      switch(var0) {
      case 'H':
      case 'K':
      case 'S':
      case 'h':
      case 'k':
      case 'm':
      case 's':
         return true;
      default:
         return false;
      }
   }

   public boolean a() {
      return this.q;
   }

   public boolean b() {
      return this.o;
   }

   public boolean c() {
      return this.p;
   }

   public char d() {
      return this.d;
   }

   public char e() {
      return this.e;
   }

   public int f() {
      return this.f;
   }

   public char g() {
      return this.c;
   }

   public char h() {
      return this.b;
   }

   public String i() {
      return this.h;
   }

   public String j() {
      return this.i;
   }

   public String k() {
      return this.j;
   }

   public String l() {
      return this.k;
   }

   public String m() {
      return this.l;
   }

   private static boolean a(Locale var0) {
      if ("zh".equals(var0.getLanguage())) {
         return true;
      } else {
         String var1 = var0.getCountry();
         if (var1 != null && !var1.equals("")) {
            var1 = var1.toUpperCase();
            return var1.equals("CN") || var1.equals("TW") || var1.equals("HK") || var1.equals("MO") || var1.equals("SG") || var1.equals("CHS") || var1.equals("CHT");
         } else {
            return false;
         }
      }
   }
}
